package com.hd.day04;

import org.junit.Test;

public class Example {
    public static void main(String[] args) {
        int[][] arr = new int[4][4];

        arr[0] = new int[]{1, 2, 3, 4, 5};
        arr[1] = new int[]{1, 2, 3, 4, 5};
        arr[2] = new int[]{1, 2, 3, 4, 5};
        arr[3] = new int[]{1, 2, 3, 4, 5};

        for (int i = 0; i < arr.length; i++) {
            if (i % 2 == 0) {
                for (int j = 0; j < arr[i].length; j++) {
                    System.out.print(arr[i][j] + "\t");
                }
                System.out.println();
            } else {
                for (int j = arr[i].length - 1; j >= 0; j--) {
                    System.out.print(arr[i][j] + "\t");
                }
                System.out.println();
            }
        }
    }


    @Test
    public void test01() {
        int[][] arr = new int[4][4];

        arr[0] = new int[]{1, 2, 3, 4};
        arr[1] = new int[]{6, 7, 8, 9};
        arr[2] = new int[]{10, 11, 12, 13};
        arr[3] = new int[]{15, 16, 17, 18};

        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j <arr[i].length; j++) {
                System.out.print(arr[i][i % 2 == 0 ? j : arr.length - 1 - j] + "\t");
            }
            System.out.println();
        }

    }


    @Test
    public void test03() {
        int[][] arr = new int[4][4];

        arr[0] = new int[]{1, 2, 3, 4};
        arr[1] = new int[]{6, 7, 8, 9};
        arr[2] = new int[]{10, 11, 12, 13};
        arr[3] = new int[]{15, 16, 17, 18};


        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {

                System.out.print(arr[i][j] + "\t");

            }
        }
    }
}
